import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2022-07-29
 * Time: 9:05
 */
public class Test {
    //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();
        System.out.print("奇数位为： ");
        for (int i = 31; i >= 1; i -= 2) {
            System.out.print(((num >> i) & 1) + " ");
        }
        System.out.println();
        System.out.print("偶数位为： ");
        for (int i = 30; i >= 0; i -= 2) {
            System.out.print(((num >> i) & 1) + " ");
        }
    }



    public static void main4(String[] args) {

        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();
        int tmp = num;
        System.out.print("偶数位为：");
        for (int i = 0; i < 32; i+=2) {
            if(tmp % 2 != 0) {
                System.out.print("1"+" ");
            }
            else{
                System.out.print("0"+" ");
            }
            tmp >>= 2;
        }
        System.out.println();
        System.out.print("奇数位为：");
        tmp = num>>1;
        for (int i = 1; i < 32; i+=2){
            if(tmp % 2 != 0) {
                System.out.print("1"+" ");
            }
            else{
                System.out.print("0"+" ");
            }
            tmp >>= 2;
        }
    }


    //求一个二进制数中的1的个数法2：

    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();
        int count = 0;
        while(num != 0){
            if((num & 1) != 0){
                count++;
            }
            num >>= 1;
        }
        System.out.println(count);
    }



    //求一个二进制数中的1的个数法3：
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int count = 0;
        while(num != 0){
            count ++;
            num = num & (num - 1);
        }
        System.out.println(count);
    }

    //求一个二进制数中的1的个数法1：
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字：");
        int num = sc.nextInt();
        int count = 0;

        for (int i = 0; i < 32; i++) {

            if(((num >> i) & 1) != 0){

                count++;
            }

        }
        System.out.println(count);
    }
}
